package Demo.Java窗口;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class MyActionListener implements ActionListener {

    private JTextField txtInput;
    private JPasswordField pwdInput;

    public MyActionListener(JTextField txtInput, JPasswordField pwdInput) {
        this.txtInput = txtInput;
        this.pwdInput = pwdInput;
    }

    public void actionPerformed(ActionEvent e) {
        System.out.println("====" + this.txtInput.getText());
        System.out.println("====" + new String(this.pwdInput.getPassword()));
        JOptionPane.showMessageDialog(null, "成功");
    }
}
